#include "ThreadPool.hpp"
#include "Log.hpp"
#include "Thread.hpp"
#include "Task.hpp"
#include <iostream>
#include <memory>
#include <unistd.h>
using namespace ThreadModule;

int main()
{
    EnableFile();
    srand(time(nullptr));
    std::unique_ptr<ThreadPool<Task>> uq(new ThreadPool<Task>());
    uq->Init();
    uq->Start();

    int cnt = 10;
    while(cnt)
    {
        Task t = GetATask();
        LOG(INFO, "new task: %s", t.DebugToString().c_str());
        uq->Enqueue(t);
        sleep(1);
        cnt--;
    }
    uq->Stop();
    uq->Wait();
    return 0;
}